package 
{
	import flash.display.Sprite;
	
	import flash.events.Event;
	import flash.events.MouseEvent;
	
	/**
	 * Settings GUI
	 * @author artem.kolesnikov 
	 */
	public class Main extends Sprite  
	{
		private var settinView:SettingView;
		private var settinHolder:SettingsHolder;
		
		public function Main():void 
		{
			settinHolder = new SettingsHolder();
			settinHolder.addEventListener(Event.OPEN, onSettingsLoad);
			
			settinView = new SettingView(stage.stageWidth, stage.stageHeight);
			settinView.scaleX = settinView.scaleY = 2;
			settinView.addEventListener(Event.SELECT, onSettingsChange);
			addChild(settinView);
		}
		
		private function onSettingsChange(event:Event):void {
			trace("settings saved");
			settinHolder.save();
		}
		
		private function onSettingsLoad(event:Event):void {
			trace("settings read")
			settinView.refresh();
		}
		
	}
	
}